#ifndef UT_MESSAGE_BUFFER_H
#define UT_MESSAGE_BUFFER_H

#include <gtest/gtest.h>
#include "test_common.h"

#include <src/message_buffer.h>
#include <testing/mocks/message_buffer_mock.h>

class ut_message_buffer : public ::testing::Test
{
};

TEST_F(ut_message_buffer, constructor)
{
	int message_id = 2;
	const char* payload = "abc";
	message::msg_handle msg(new message(message_id, payload, sizeof(payload)));

    message_buffer buffer;

    ASSERT_FALSE(buffer.pop());
    buffer.push(msg);

    message::msg_handle buffered_msg = buffer.pop();
    EXPECT_EQ(2, buffered_msg->id);
    EXPECT_EQ(sizeof(payload), buffered_msg->payload_size);
    EXPECT_EQ(payload, buffered_msg->payload);

    ASSERT_FALSE(buffer.pop());
}

#endif // MESSAGE_RECEIVER_TEST_H

